/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.thesis.utils;

import java.util.LinkedList;

import com.thesis.algorithm.Device;
import com.thesis.algorithm.Sample;

/**
 *
 * @author Aya Hikaru
 */
public class hVelocityEstimateTest extends VelocityEstimate{
    private double lastLat = 0;
    private double lastLng = 0;
    public hVelocityEstimateTest (Device d)
    {
        
        super(null);
        Sample s;
        for(int i = 0; i < d.sampleList.size(); i++)
        {
            s = d.sampleList.get(i);
            this.Add(i, Double.parseDouble(s.lat), Double.parseDouble(s.lng));
        }
    }
    
    
    public hVelocityEstimateTest()
    {
        //do nothing       
    }
    
    @Override
    public void Add (int timeStamp, LinkedList<Character> BusStops, short [] listOfBusRoute)
    {
        // donothing
    }
    public void Add (int timeStamp, double lat, double lng)
    {
        if (lastLat < .000001 || lastLng < .000001 )
        {
            lastLat = lat;
            lastLng = lng;
            return;
        }           
        double tmp = CoordinateConversion.LatLngDistance(lat, lng, lastLat, lastLng);
        if (tmp < .000001)
        {
        
        }
        this.velocityList.add(new VelocityElement(timeStamp, tmp));
        lastLat = lat;
        lastLng = lng;
        lastTimeStamp = timeStamp;
    }
}
